
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display"%>
<%@ taglib uri="/WEB-INF/config/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="http://ssh.org/selects" prefix="ssh"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
String applicationPath = basePath + "/" + "application";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="<%=path%>/css/jinmu_style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="<%=path%>/js/util.js"></script>
		<script type='text/javascript' src='<%=path%>/frame/orgSelect/js/ajaxInitSelect.js'></script>
<script language="javascript" src="<%=path%>/js/SyncCommon.js"></script>
<script language="javascript">
       var ids_map = new Map();
</script>
</head>
<body>
<html:form styleId="yfProjectApprovalForm" action="updatePerson.do?method=updatePerson" onsubmit="return save();">
<html:hidden property="id" value="${yfProjectApproval.id}"/>
<html:hidden property="processId" value="${yfProjectApproval.processId}"/>
<html:hidden property="auditStatus" value="${yfProjectApproval.auditStatus}"/>
<input type ="hidden" name="projectid" id="projectid" value="${yfProjectApproval.projectNo}"/>
<input name='lastIndex' type='hidden' id='lastIndex' value="${projectTeamsCount+1}" />
<table cellspacing="0" cellpadding="0" width="98%" align="center"  border="0" class="margtb5">
		    <tr>
		       <td align="left" class="padl5 lan12"><img src="<%=path%>/images/img-11.gif" width="12" height="12"> 项目管理 &gt; 项目立项 &gt; 立项申请 &gt; 修改项目组成员</td>
		    </tr>
       </table>
		
	
	  <table width="98%" align="center" border="0" cellspacing="0" cellpadding="0" class="margb5">
	<tr><!-- onMouseMove -->
	  <td width="18%" align="center" class="objgy_zi1" id="objgy1" style="cursor:hand;" onclick="bianGY(this.id,'nrgy1')">基本信息</td>
	  <td width="20%" align="center" class="objgy_zi2" id="objgy2" style="cursor:hand;" onclick="bianGY(this.id,'nrgy2')">项目组成员</td>
	   <td align="right" ><span >
        &nbsp;
    </span></td>
	</tr>
	<tr>
	  <td colspan="5">
		<table cellspacing="1" cellpadding="0" width="100%" align="center"  border="0" class="bgcolor2" id="nrgy1" style="display:">
		     <tr class="bgcolor">
	   <td width="18%" align="right" class="zi13">项目名称：<font color="red">*&nbsp;</font></td>
	   <td width="32%"  align="left" class="pad2 zi13">
	                               				 <input type="text" flag="true"  maxlength="60"  valid="required" errMsg="请输入项目名称！" id="projectName" name="projectName" value="${yfProjectApproval.projectName}"  readonly="true"/>
	                               				 
		         		                       		  
	  </td>

 
	   <td width="18%" align="right" class="zi13">项目编号：</td>
	   <td width="32%"  align="left" class="pad2 zi13">
	                               				 <input type="text" readonly="true" id="projectNo" value="${yfProjectApproval.projectNo}" name="projectNo"/>
		         		                       		  
	  </td>

        </tr> 
             <tr class="bgcolor">
	   <td width="18%" align="right" class="zi13">项目类型：</td>
	   <td width="32%"  align="left" class="pad2 zi13">
	     <ssh:select id="projectType" propertyName="projectType" pid="PROJECT_TYPE" defaultName="${yfProjectApproval.projectType}"  styles="width:100px;" type="1" readonly="true"  />
		         		                       		  
	  </td>

 
	   <td width="18%" align="right" class="zi13">项目机构：</td>
	   <td width="32%"  align="left" class="pad2 zi13">

	            <ssh:select readonly="true" id="projectOrg" propertyName="projectOrg" firstShow="Y" dataSource="collection" selectList="${orgSelect}"  type="1" defaultName="${yfProjectApproval.projectOrg}"/>
		         		                       		  
	  </td>

        </tr> 
        <tr class="bgcolor">
 

 
	   <td width="18%" align="right" class="zi13"><bean:message key="com.application.yfprojectapproval.entity.yfprojectapproval.createpage.ownYear" bundle="yfprojectapproval"/>：</td>
	   <td width="32%"  align="left" class="pad2 zi13">
	   
	                   <html:select property="ownYear" disabled="true" style="width:100px" value="${yfProjectApproval.ownYear}">
	                      	 <c:forEach var="i" begin="2010" end="2020" step="1">
	                      	 		<html:option value="${i}">${i}</html:option>
                             </c:forEach>
	                    </html:select>
	                               				
		         		                       		  
	  </td>
       <td width="18%" align="right" class="zi13"><bean:message key="com.application.yfprojectapproval.entity.yfprojectapproval.createpage.projectManager" bundle="yfprojectapproval"/>：</td>
	   <td width="32%"  align="left" class="pad2 zi13">
	                               				 <input type="text" id="rname" readonly="true" value="${yfProjectApproval.rname}" name="rname"/>
	                               				  <input type="hidden" id="projectManager" value="${yfProjectApproval.projectManager}" name="projectManager"/>
		         		                       		  
	  </td>
        </tr>
 
        <tr class="bgcolor">
	  

 
	   <td width="18%" align="right" class="zi13"><bean:message key="com.application.yfprojectapproval.entity.yfprojectapproval.createpage.planFee" bundle="yfprojectapproval"/>：<font color="red">*&nbsp;</font></td>
	   <td width="32%"  align="left" colspan="3" class="pad2 zi13">
	                               				 <input type="text" readonly="true" flag="true"  maxlength="13" valid="required|isWanYuan" errMsg="请输入计划费用！|请输入正确的金额！" id="planFee" value="${yfProjectApproval.planFee}" name="planFee"/>
		         		                       		  
	  </td>

        </tr>
 
        <tr class="bgcolor">
	   <td width="18%" align="right" class="zi13"><bean:message key="com.application.yfprojectapproval.entity.yfprojectapproval.createpage.projectGround" bundle="yfprojectapproval"/>：</td>
	   <td width="32%"  align="left" colspan="3"  class="pad2 zi13">
	           <textarea rows="6" cols="70" id="projectGround" readonly="true"  name="projectGround" flag="true"  valid="limitLength" max="500" errMsg="立项背景输入长度不能超过500个汉字">${yfProjectApproval.projectGround}</textarea>长度不超过500个字
	                               				 
		         		                       		  
	  </td>
  </tr>
    <tr class="bgcolor">
 
	   <td width="18%" align="right" class="zi13"><bean:message key="com.application.yfprojectapproval.entity.yfprojectapproval.createpage.planContent" bundle="yfprojectapproval"/>：</td>
	   <td width="32%"  align="left" colspan="3" class="pad2 zi13">
	                  <textarea rows="6" cols="70" id="planContent" readonly="true" name="planContent" flag="true"  valid="limitLength" max="500" errMsg="研究内容输入长度不能超过500个汉字">${yfProjectApproval.planContent}</textarea>长度不超过500个字
		         		                       		  
	  </td>

        </tr>
 
        <tr class="bgcolor">
	   <td width="18%" align="right" class="zi13"><bean:message key="com.application.yfprojectapproval.entity.yfprojectapproval.createpage.projectGoals" bundle="yfprojectapproval"/>：</td>
	   <td width="32%"  align="left" colspan="3" class="pad2 zi13">
	                               			  <textarea rows="6" cols="70" readonly="true" id="projectGoals" name="projectGoals" flag="true"  valid="limitLength" max="500" errMsg="目标效益输入长度不能超过500个汉字">${yfProjectApproval.projectGoals}</textarea>长度不超过500个字
		         		                       		  
	  </td>
    
   </tr>
    <tr class="bgcolor">
	   <td width="18%" align="right" class="zi13"><bean:message key="com.application.yfprojectapproval.entity.yfprojectapproval.createpage.device" bundle="yfprojectapproval"/>：</td>
	   <td width="32%"  align="left"  colspan="3" class="pad2 zi13">
	    <textarea rows="6" cols="70" id="device" name="device" flag="true" readonly="true"  valid="limitLength" max="500" errMsg="需要购置的仪器设备输入长度不能超过500个汉字">${yfProjectApproval.device}</textarea>长度不超过500个字
		         		                       		  
	  </td>

        </tr>
 
        <tr class="bgcolor">
	   <td width="18%" align="right" class="zi13"><bean:message key="com.application.yfprojectapproval.entity.yfprojectapproval.createpage.materies" bundle="yfprojectapproval"/>：</td>
	   <td width="32%"  colspan="3" align="left" class="pad2 zi13">
	    <textarea rows="6" cols="70" id="materies" name="materies" flag="true" readonly="true"  valid="limitLength" max="500" errMsg="需要购置的物料输入长度不能超过500个汉字">${yfProjectApproval.materies}</textarea>长度不超过500个字
		         		                       		  
	  </td>

         </tr>
 
        <tr class="bgcolor">
	   <td width="18%" align="right" class="zi13"><bean:message key="com.application.yfprojectapproval.entity.yfprojectapproval.createpage.expense" bundle="yfprojectapproval"/>：</td>
	   <td width="32%" colspan="3"  align="left" class="pad2 zi13">
	    <textarea rows="6" cols="70" id="expense" name="expense" flag="true"  readonly="true" valid="limitLength" max="500" errMsg="费用构成输入长度不能超过500个汉字">${yfProjectApproval.expense}</textarea>长度不超过500个字
	                               				
		         		                       		  
	  </td>

        </tr>
 
        <tr class="bgcolor">

 <td width="18%" align="right" class="zi13"><bean:message key="com.application.yfprojectapproval.entity.yfprojectapproval.createpage.remark" bundle="yfprojectapproval"/>：</td>
	   <td width="32%" colspan="3" align="left" class="pad2 zi13">
	        <textarea rows="6" cols="70" id="remark" name="remark" flag="true" readonly="true"  valid="limitLength" max="500" errMsg="备注输入长度不能超过500个汉字">${yfProjectApproval.remark}</textarea>长度不超过500个字
		         		                       		  
	  </td>
        </tr>
         <tr>
					    <td colspan="4">
					          <iframe width="100%" height="150px" onload="this.height=show_attachment.document.body.scrollHeight"
							src="<%=path%>/queryAttachment.do?method=queryAttachment&fid=${yfProjectApproval.id}&type=10002&isShowAdd=N"
											; scrolling="no" frameborder="0" name="show_attachment"
											id="show_attachment"></iframe>
					    </td>
					  </tr>		
                 </table>
                 <p>
		 
 
		
				
		 
		<table width="100%"  align="center" border="0" cellspacing="0" cellpadding="0" class="kuang2" id="nrgy2" style="display:none">
		  <tr>
			<td align="left" class="pad5">
			<table cellspacing="1" id="teamsTab" cellpadding="0" width="100%" align="center"  border="0" class="bgcolor2 margb5">
			  <tr class="bgcolor1">
                <td align="center" width="10%" class="zi13b">序号</td>
				<td align="center" width="10%" class="zi13b">姓名</td>
				<td align="center" width="17%" class="zi13b">级别</td>
				<td align="center" width="20%" class="zi13b">机构</td>
				<td align="center" width="5%" class="zi13b">职务</td>
			    <td align="center" width="10%" class="zi13b">操作</td>
			  </tr>
			   <logic:present name="projectTeamsList">
                      <logic:iterate id="projectTeams" name="projectTeamsList" indexId="indexId">
                       <script language="javascript">
                         ids_map.put('${projectTeams.userId}','${projectTeams.userId}');
                      </script>
                      <c:if test="${indexId==0}">
	                           <tr class="bgcolor" align="middle" id="trTeams${indexId+1}">
	                      
	                        <td align="center" class="zi13" width="10%">${indexId+1}<input type="hidden" name="model${indexId+1}*ordernum" value="${indexId+1}"/></td>     
			                <td align="center" class="zi13" width="10%"><input  type='hidden' name='model${indexId+1}*userId' id='model${indexId+1}*userId' value="${projectTeams.userId}"/><input type="hidden" id='model${indexId+1}*userName' name='model${indexId+1}*userName' value='${projectTeams.userName}' size='10'/>${projectTeams.userName}
			                </td>
							<td class="padl5 zi13"><input type="hidden" name='model${indexId+1}*userLevel' id='model${indexId+1}*userLevel' maxlength='15' value='${projectTeams.userLevel}'>${projectTeams.userLevel}</td>
							<td class="padl5 zi13"><input type="hidden" name='model${indexId+1}*org' id='model${indexId+1}*org' value='${projectTeams.org}'>${projectTeams.org}</td>
							<td align="center" class="zi13">项目经理</td>
							<td align="center" class="zi13"></td>
	                      
	                      </tr>
                      </c:if>
                       <c:if test="${indexId!=0}">
                      <tr class="bgcolor" align="middle" id="trTeams${indexId+1}">
                      
                     <td align="center" class="zi13" width="10%">${indexId+1}<input type="hidden" name="model${indexId+1}*ordernum" value="${indexId+1}"/></td>     
                <td align="center" class="zi13" width="10%"><input  type='hidden' name='model${indexId+1}*userId' id='model${indexId+1}*userId' value="${projectTeams.userId}"/><input type="text" id='model${indexId+1}*userName' name='model${indexId+1}*userName' value='${projectTeams.userName}' size='10'/><input type="button"  value="选择" class="buttonbg" onclick='choosePerson("${indexId+1}")')">
                </td>
				<td class="padl5 zi13"><input type="text" name='model${indexId+1}*userLevel' id='model${indexId+1}*userLevel' maxlength='15' value='${projectTeams.userLevel}'></td>
				<td class="padl5 zi13"><input type="text" name='model${indexId+1}*org' id='model${indexId+1}*org' value='${projectTeams.org}'></td>
				<td align="center" class="zi13">研发人员</td>
				<td align="center" class="zi13"><input class="buttonbg" type="button" name="id" value="删除" onclick="delRow('${indexId+1}')"/></td>
                      
                      </tr>
                      </c:if>
                     </logic:iterate>
                     </logic:present>
			</table>
			<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
			  <tr>
				<td>
				  <input type="button" onclick="insertRow();" name="Submit2" value="新增" class="buttonbg">
				 </td>
			  </tr>
			</table></td>
		  </tr>
		</table></td>
	</tr>
  </table>
	   

		<p><p><p>
	
  <table width="98%" align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
        <td align="center">
		<input class="buttonbg" id="but_save"  style="cursor:hand"  type="submit" value="<bean:message key='com.manager.common.yfprojectapproval.save' bundle="yfprojectapproval"/>" name="but_save" />
		  &nbsp;&nbsp;&nbsp;
		 
	     <input class="buttonbg" id="but_return"  style="cursor:hand"  type="button" value="<bean:message key='com.manager.common.yfprojectapproval.return' bundle="yfprojectapproval"/>" name="but_return" onClick="javascript:history.go(-1);"/>
		 </td>
  </tr>
</table>

</html:form>
</body>
</html>


<script>
bianGY('objgy2','nrgy2');
function save(){
   if(validateForm(document.forms[0],'Y'))
   {
	return true;
    }else{
	return false;
    }
}

//提交审核
function returnSubmits(){
    if(validateForm(document.forms[0],'Y'))
	{
	 if(confirm("是否提交审核？") ){
	    document.forms[0].action="submitWorkFlow.do?method=submitWorkFlow&submitType=update";
	    document.forms[0].submit();
		return true;
	 }
	 return false;
		
	}else{
	    return false;
	}
	
}

function chooseProject(){   
    var syncHelper = new SyncHelper();
	var url = "popuSelectProjectList.do?method=popuSelectProjectList&projectManager=${loginUser.id}&random=" + new Date();
	var searchWin = window.showModalDialog(url,window,"help:no;scroll:yes;resizable:no;status:0;dialogWidth:1000px;dialogHeight:600px;center:yes" ); 	
    if(searchWin){
         $("projectName").value = searchWin["projectName"]==undefined?"":searchWin["projectName"];
		 $("projectNo").value = searchWin["projectNo"]==undefined?"":searchWin["projectNo"];
		 syncHelper.selectedByValue(searchWin["projectOrg"],"projectOrg");
		 $("projectid").value = searchWin["projectNo"]==undefined?"":searchWin["projectNo"];
		 //$jq("#projectOrg option").not(":selected").attr("disabled", "disabled");
    }
}


/**
  增加一行
**/
function insertRow(){
    var lastIndex = $('lastIndex').value;
        var addrow = $('teamsTab').insertRow();
        addrow.className = "bgcolor";
        var addcellone = addrow.insertCell();
	    addcellone.setAttribute("align","center");
	    addrow.setAttribute("id","trTeams"+lastIndex);  
		addcellone.innerHTML = lastIndex;
		addcellone = addrow.insertCell();
		addcellone.setAttribute("align","center");
		addcellone.innerHTML = "<input  type='hidden' value='" + lastIndex + "' id='model"+ lastIndex +"*ordernum' name='model"+ lastIndex +"*ordernum'/><input  type='hidden' id='model"+ lastIndex +"*userId' name='model"+ lastIndex +"*userId'/><input readonly='true' flag='true'   valid='required' size='10' errMsg='请输入第"+lastIndex+"行的姓名！' type='text' id='model"+ lastIndex +"*userName' name='model"+ lastIndex +"*userName'/><input type='button' style='cursor:hand;' value='选择' class='buttonbg' onclick='choosePerson("+ lastIndex +")'>";
	    addcellone = addrow.insertCell();
	    addcellone.setAttribute("align","center");
		addcellone.innerHTML = "<input type='text' maxlength='15' id='model"+ lastIndex +"*userLevel' name='model"+ lastIndex +"*userLevel'/>";
		addcellone = addrow.insertCell();
		addcellone.setAttribute("align","center");
		addcellone.innerHTML = "<input  type='hidden' id='model"+ lastIndex +"*orgid' name='model"+ lastIndex +"*orgid'/><input flag='true' readonly='true'   valid='required' errMsg='请输入第"+lastIndex+"行的部门！' type='text' id='model"+ lastIndex +"*org' name='model"+ lastIndex +"*org'/>";
		addcellone = addrow.insertCell();
		addcellone.setAttribute("align","center");
		addcellone.innerHTML = "研发人员";
		addcellone = addrow.insertCell();
		addcellone.setAttribute("align","center");
		addcellone.innerHTML = "<input type='button' style='cursor:hand;' class='buttonbg' name='id' value='删除' onclick='delRow(" + lastIndex + ")'/>";
		$('lastIndex').value = parseInt(lastIndex) + 1;

   
}

function delRow(index){
    var uid = "model"+ index +"*userId";
    var uidvalue = $(uid).value;
    ids_map.remove(uidvalue);
	var table = $('teamsTab');
	var row = $('trTeams' + index);
	var rowIndex = row.rowIndex;
	table.deleteRow(rowIndex); 
    for(var i=rowIndex;i<table.rows.length;i++){
       table.rows[i].cells[0].innerHTML = i.toString();
    }
    $('lastIndex').value = table.rows.length;

}


function choosePerson(lastIndex){   
    var selectids = ids_map.toString();
    var syncHelper = new SyncHelper();
	var url = "popuSelectEmployee.do?method=popuSelectEmployee&ids="+selectids+"&random=" + new Date();
	var searchWin = window.showModalDialog(url,window,"help:no;scroll:yes;resizable:no;status:0;dialogWidth:1000px;dialogHeight:600px;center:yes" ); 	
    if(searchWin){
         var uid = "model"+ lastIndex +"*userId";
         var rname = "model"+ lastIndex +"*userName";
         var level = "model"+ lastIndex +"*userLevel";
         var org = "model"+ lastIndex +"*org";

         $(uid).value = searchWin["id"]==undefined?"":searchWin["id"];
         $(rname).value = searchWin["rname"]==undefined?"":searchWin["rname"];
		 $(level).value = searchWin["level"]==undefined?"":searchWin["level"];
		 $(org).value = searchWin["org"]==undefined?"":searchWin["org"];
		 //$jq("#projectOrg option").not(":selected").attr("disabled", "disabled");
         ids_map.put($(uid).value,$(uid).value);
		 
    }
}
</script>





